with authentication;
with ada.text_io;
with v_string; use v_string;

procedure test_auth is

    package t_io renames ada.text_io;

    username : vstring;
    password : vstring;
    myID : Integer;
    okay : Boolean;
    c : Character;
begin
    authentication.init;
    t_io.put("enter username  > ");
    vget(username);
    t_io.put("enter password  > ");
    vget(password);
    okay := authentication.authenticate(toVstring("matt"), toVstring("password"));
    if okay = true then
	myID := authentication.getIDFromUsername(username);
	t_io.put_line("login successful, with ID " & integer'image(myID));
	loop
	    t_io.put("delete user? (y/n)  > ");
	    t_io.get(c);
	    t_io.skip_line;
	    if c = 'y' then
		okay := authentication.deleteUser(myID);
		if okay = true then
		    t_io.put_line("User deleted successfully");
		else
		    t_io.put_line("Error deleting user");
		end if;
		exit;
	    elsif c = 'n' then
		exit;
	    end if;
	end loop;
    else
	t_io.put_line("login failed");
    end if;

end test_auth;
